{extend name="index"/}
{block name="title"}后台管理 - {:sysconf('title')}{/block}
{block name="content"}
<section class="Hui-article-box">
    <nav class="breadcrumb">
        <i class="Hui-iconfont">&#xe67f;</i> <a href="{:url('Index/index')}">首页</a>
        <span class="c-gray en">&gt;</span> 财务管理 <span class="c-gray en">&gt;</span> 返佣记录
        <a id="btn-refresh" class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" >
            <i class="Hui-iconfont">&#xe68f;</i>
        </a>
    </nav>
    <div class="Hui-article">
        <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"> <a href="javascript:;" onclick="ratio_add('添加','add.html','','510')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加</a></span>  </div>
        <article class="cl pd-20">
            <div class="mt-20">
                <table class="table table-border table-bordered table-hover table-bg table-sort">
                    <thead>
                        <tr class="text-c">
                            <th width="100">ID</th>
                            <th width="60">业绩最低金额</th>
                            <th width="60">业绩最高金额</th>
                            <th width="50">奖金比例</th>
                            <th width="100">更新时间</th>
                            <th width="100">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                    {volist name="list" id="val"}
                    <tr class="text-c">
                        <td>{$val['id']}</td>
                        <td>{$val['min']}</td>
                        <td>{$val['max']}</td>
                        <td>{$val['ratio']}</td>
                        <td>{$val['add_time']}</td>
                        <td class="td-manage">
                            <a title="编辑" href="javascript:;" onclick="ratio_edit('编辑','edit.html','{$val['id']}','','510')" class="ml-5" style="text-decoration:none">
                                <i class="Hui-iconfont">&#xe6df;</i>
                            </a>
                            <a title="删除" href="javascript:;" onclick="ratio_del(this,'{$val['id']}')" class="ml-5" style="text-decoration:none">
                                <i class="Hui-iconfont">&#xe6e2;</i>
                            </a>
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
            </div>
        </article>
    </div>
</section>
<script>
    function ratio_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            $.ajax({
                url:"{:url('System/del')}",
                type:'post',
                data:{'id':id},
                dataType:'json',
                success:function(data){
                    if(data.code==0) {
                        $(obj).parents("tr").remove();
                        layer.msg(data.msg,{icon:6,time:1000});
                    }
                    else {
                        layer.msg(data.msg,{icon:5,time:1000});
                    }
                },
                error:function(data){
                    layer.msg('500系统错误，请联系管理员！',{icon:5,time:1000});
                }
            });
        });
    }
    function ratio_add(title,url,w,h){
        layer_show(title,url,w,h);
    }
    function ratio_edit(title,url,id,w,h){
        layer_show_id(title,url,id,w,h);
    }
</script>
{/block}